import requests
import json


class InterfaceTest04():
    @classmethod
    def study_json(self):
        url = 'http://www.woniusb.com:8090/woniusales/goods/querybatch'
        data = {
            'batchname': 'GB20180406'
        }
        req = requests.post(url, data)
        print(req.status_code)
        print(req.text)
        print(type(req.text))
        print('提取json----1*********************')
        json_data = json.loads(req.text)
        print(json_data)
        for item in json_data:
            print(item)
        print(json_data[3]['costunitprice'])
        print('提取json----2*********************')
        jsonData = req.json()
        print(jsonData)
        print(json_data[0]['costunitprice'])


if __name__ == '__main__':
    InterfaceTest04.study_json()
